package com.caishi.lkx.gateway;

import com.zzw.common.handler.ServletInvocableHandlerPipeline;
import com.zzw.common.keray.factory.ServletInvocableHandlerMethodFactory;
import com.zzw.common.resolver.KerayHandlerMethodArgumentResolverConfig;
import com.caishi.lkx.common.Sensitive;
import com.caishi.lkx.common.role.RoleAuth;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Lazy;
import org.springframework.context.annotation.Primary;
import org.springframework.web.method.HandlerMethod;
import org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod;

import javax.annotation.Resource;

/**
 * @author by keray
 * date:2021/4/1 4:26 下午
 */
@Configuration
@Primary
public class VipServletInvocableHandlerMethodFactory implements ServletInvocableHandlerMethodFactory {

    @Resource
    @Lazy
    private KerayHandlerMethodArgumentResolverConfig kerayHandlerMethodArgumentResolverConfig;

    @Resource
    private RoleAuth roleAuth;


    @Resource
    private Sensitive sensitive;

    @Override
    public ServletInvocableHandlerMethod create(HandlerMethod handlerMethod, ServletInvocableHandlerPipeline[] handlers) {
        return new VipRoleServletInvocableHandlerMethod(handlerMethod, handlers, kerayHandlerMethodArgumentResolverConfig, roleAuth);
    }
}
